From e7ccd01faf6a9f33b1fd4a2431ce25c5de8a9b38 Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 9 Mar 2006 23:07:27 +0100 Subject: [PATCH] Fix a few small issues in xc_domain_dumpcore: xc_domain_getinfo returns information about a domain, but not necessarily the one you asked about. Add check for this. max_vcpu_id in xc_domain_getinfo is really an ID, not a count, so make the loop include the last VCPU Signed-off-by: Ben Thomas --- tools/libxc/xc_core.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/libxc/xc_core.c b/tools/libxc/xc_core.c index 6e403f0e99..7e198ba891 100644 --- a/tools/libxc/xc_core.c +++ b/tools/libxc/xc_core.c @@ -54,9 +54,14 @@ xc_domain_dumpcore(int xc_handle, goto error_out; } - for (i = 0; i < info.max_vcpu_id; i++) + if (domid != info.domid) { + PERROR("Domain %d does not exist", domid); + goto error_out; + } + + for (i = 0; i <= info.max_vcpu_id; i++) if (xc_vcpu_getcontext(xc_handle, domid, - i, &ctxt[nr_vcpus]) == 0) + i, &ctxt[nr_vcpus]) == 0) nr_vcpus++; nr_pages = info.nr_pages; -- 2.30.2